<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>还款明细 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">承租人</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" readonly class="ui-textbox" value="${cstNm}">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">还款日期</div>
                    <div class="field">
                        <input name="acceptDateMin" id="acceptDateMin" type="text" class="ui-datepicker" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">至</div>
                    <div class="field">
                        <input name="acceptDateMax" id="acceptDateMax" type="text" class="ui-datepicker" value="">
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, menu = null;
    $(function () {
        var cstId='${cstId}';
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/risk/overdueCollect/initCstCapFundList.do?cstId='+cstId,
            parms:{fundCd:0},
            method: 'get',
            columns: [
                {display: '资金编号', name: 'code', minWidth: 130, align: 'left', enabledSort: false,
                    render:function(rowdata,index,value){
                        return '<a style="cursor: pointer;" onclick="qyDecompose('+rowdata.id+');">'+rowdata.code+'</a>'
                    }},
                {display: '来款户名', name: 'comeName', minWidth: 50, align: 'left', enabledSort: false},
                {display: '来款账号', name: 'comeCode', minWidth: 100, align: 'left', enabledSort: false},
                {display: '金额', name: 'amount', width: 80, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        return FormatMoney(rowdata.amount/100);
                    }
                },
                {display: '到账日期', name: 'acceptDate', width: 90, align: 'center', enabledSort: false,render:renderDate},
                {display: '当时逾期天数', name: 'overdueDay', width: 90, align: 'center', enabledSort: false,render:renderDate},
                {display: '收款名称', name: 'acceptName', minWidth: 100, align: 'left', enabledSort: false},
                {display: '收款账号', name: 'acceptCode', minWidth: 100, align: 'left', enabledSort: false},

            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: true,
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
            form.setData({  //重置select等特殊表单
                "*Cd": " "
            });
        });
    });

    /**
     * 跳转到核销明细
     * @param fundId 资金ID
     */
    function vfDtl(fundId){
        // capital/capFund/toDecomDtlPage.do?fundId=180823013011170
        parent.parent.mainApp.f_addTab('overdue_vf_dtl'+fundId,'客户详情','<%=path%>/capital/capFund/toDecomDtlPage.do?fundId='+fundId);

    }
    //查看分解单
    function qyDecompose(id){
        Add_navTab('toDecomDtlPage_'+id, "分解单查看", '<%=path%>/capital/capFund/toDecomDtlPage.do?fundId='+id, null);
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }
</script>

</body>
</html>
